package com.qf.openapi.web.master.controller;

import com.qf.openapi.web.master.entity.User;
import com.qf.openapi.web.master.servcie.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("find/{id}")
    @ResponseBody
    public User getUser(@PathVariable("id") Integer id){

        //对参数做一些校验

        //调用service层的方法进行业务处理
        User user = userService.findUser(id);

        //返回结果
        return user;

    }

}
